package other;

import java.util.HashMap;

/**
 * @program: javase
 * @description:
 * @author: lld
 * @create: 2021-04-01 11:19
 **/
public class DvcDevice {
    public static void main(String[] args) {
        HashMap<Object, Object> map = new HashMap<>();
        map.put(1, 2);
        Object o = map.computeIfAbsent(1, k -> 4);
//        相当于下面,key不存在则加入
        Object o1 = map.get(1);
        if(o1==null){
            map.put(1, 4);
        }
        System.out.println(o);
    }
}
